

//
//  MBReleaseShopVC.m
//  发布求租
//
//  Created by MB__Lee on 2018/6/7.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "MBReleaseShopVC.h"


#import "MBRegionSelectVC.h"

@interface MBReleaseShopVC ()<UITableViewDelegate,MBSeletedCVCDelegate,MBRegionSelectVCDelegate>
@property(nonatomic,strong)UITableView *shopTableview;
@end

@implementation MBReleaseShopVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.selectedIndex = 2;
    self.releseModel.category = @"1004";
    
    self.sourceMut = [MBReleaseSourceTool MBReleaseSourceTool_CreatWithType:SourceTypeShop];
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    _shopTableview = tableView;
    //此处让子类实现
    if (indexPath.row == 4) {
        MBSeletedCVC *vc = [MBCVCFactory MBCVCFactoryCreatWithType:CVCTypeLeixingShop];
        vc.delegate = self;
        [self.navigationController pushViewController:vc animated:YES];
        
        
    }else if (indexPath.row == 5){
        MBSeletedCVC *vc = [MBCVCFactory MBCVCFactoryCreatWithType:CVCTypeCharecterShop];
        vc.delegate = self;
        [self.navigationController pushViewController:vc animated:YES];
    }else if (indexPath.row == 6){
        MBRegionSelectVC *regionvc  = [[MBRegionSelectVC alloc]init];
        regionvc.delegate = self;
        
        [self.navigationController pushViewController:regionvc animated:YES];
        
    }
}

//#pragma mark ---区域选择代理方法
//-(void)MBRegionSelectVCSendDistrictModel:(ArDistrictModel *)disModel regionModel:(ArRegionModel *)reModel{
//    
//     self.releseModel.district = disModel.code;
//    self.releseModel.region = reModel.code;
//}

#pragma mark--MBSeletedCVCDelegate
-(void)MBSeletedCVC:(MBSeletedCVC *)selectedVC SendSelectedMut:(NSMutableArray *)mut{
    if (selectedVC.type == CVCTypeLeixingShop) {
        self.releseModel.shop_type = mut;
        
        if (mut.count) {
            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:4 inSection:0];
            MBConentMoreCell *cell = (MBConentMoreCell *)[_shopTableview cellForRowAtIndexPath:indexPath];
            [cell changeStateASSelected];
        }
        
    }else if (selectedVC.type == CVCTypeCharecterShop){
        self.releseModel.shop_characteristic = mut;
        
        if (mut.count) {
            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:4 inSection:0];
            MBConentMoreCell *cell = (MBConentMoreCell *)[_shopTableview cellForRowAtIndexPath:indexPath];
            [cell changeStateASSelected];
        }
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
